<!DOCTYPE html>
<html>
<head>
    <link href="/css/layui/css/layui.css" rel="stylesheet">
    <link href="/css/hadmin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <link href="/css/hadmin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/hadmin/css/animate.css" rel="stylesheet">
    <link href="/css/hadmin/css/animate.css" rel="stylesheet">
    <link href="/css/bootstrap-select.min.css" rel="stylesheet">
    <link href="/css/multi-select.dist.css" rel="stylesheet">
    <link href="/css/hadmin/css/style.css?v=4.1.0" rel="stylesheet">
</head>

<div class="wrapper wrapper-content animated fadeInUp">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-title">
                    <h5>金币流水</h5>
                </div>
                <div class="ibox-content">
                    <div class="form-group">
                        <form class="form-inline" method="post" action="/flow/coin_log" id="form">
                            <input type="hidden" name="export" id='export' value="/">
                            <input type="text" class="form-control" id="starttime" name="starttime"
                                   value="<?=$res['starttime']?>" autocomplete="off"
                                   placeholder="开始日期">~
                            <input type="text" class="form-control" id="endtime" name="endtime"
                                   value="<?=$res['endtime']?>" autocomplete="off"
                                   placeholder="结束日期">
                            <button type="button" class="btn btn-primary" id="search"> 搜索流水</button>
                            <a class="btn btn-primary radius" id="excle">数据导出</a>
                        </form>
                    </div>
                </div>
                <div class="page-container">
                    <div class="mt-20">
                        <table class="table table-hover table-striped">
                            <thead>
                            <tr>
                                <th >ID</th>
                                <th >用户id</th>
                                <th >用户昵称</th>
                                <th >金币数</th>
                                <th >描述</th>
                                <th >记录时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach($coin as $value): ?>
                            <tr>
                                <td><?= $value['Flow']['id']?></td>
                                <td><?= $value['Flow']['uid']?></td>
                                <td><?= $value['u']['username']?></td>
                                <td><?= $value['Flow']['amount']?></td>
                                <td><?= $value['Flow']['desc']?></td>
                                <td><?= date('Y-m-d H:i:s',$value['Flow']['init_time'])?></td>
                            </tr>
                            <?php endforeach;?>
                            </tbody>
                        </table>
                    </div>
                </div>
                <?php if($pageCount > 1): ?>
                <nav aria-label="Page navigation" style="text-align: center">
                        <ul class="pagination">

                            <li><a><?= $count?> 条记录 <?= "$page/$pageCount" ?>页</a></li>
                            <li>
                                <a class="mypagea">
                                    <input type="text" class="form-control mypage"  placeholder="页码">
                                </a>
                            </li>
                            <li>
                                <a id="page">
                                    跳转
                                </a>
                            </li>
                            <li
                            <?php if($page == 1 || !$page): ?> class="disabled" <?php endif; ?> >
                            <a <?php if($page == 1 || !$page): ?>  onclick="return false" <?php endif; ?>
                            href="<?= $url.'&page='.($page-1) ?>" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                            </a>
                            </li>
                            <?php for($i=$page-1;$i<$page+9;$i++): ?>
                                <li
                                <?php if($page == $i+1): ?> class="active" <?php endif; ?>> <a
                                    href="<?= $url.'&page='.($i+1) ?>"><?=$i+1?></a></li>
                            <?php endfor; ?>

                            <li
                            <?php if($page == $pageCount): ?> class="disabled" <?php endif; ?> >
                            <a <?php if($page == $pageCount): ?> onclick="return false" <?php endif; ?>
                            href="<?= $url.'&page='.($page+1) ?>" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                            </a>
                            </li>
                        </ul>
                </nav>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
</div>
</html>

<script src="/css/layui/layui.js"></script>
<script src="/css/hadmin/js/jquery.min.js?v=2.1.4"></script>
<script src="/css/hadmin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/css/hadmin/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/css/hadmin/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/css/hadmin/js/plugins/layer/layer.min.js"></script>
<script src="/css/hadmin/js//hAdmin.js?v=4.1.0"></script>
<script src="/css/hadmin/js/index.js"></script>
<script src="/js/moment-with-locales.min.js"></script>
<script src="/js/bootstrap-datetimepicker.min.js"></script>
<script src="/css/hadmin/js/plugins/toastr/toastr.min.js"></script>
<script src="/js/bootstrap-select.min.js"></script>
<script src="/js/jquery.multi-select.js"></script>

<script>
    $('#starttime').datetimepicker({locale: 'zh-cn', format: 'YYYY-MM-DD HH:mm:ss',});
    $('#endtime').datetimepicker({locale: 'zh-cn', format: 'YYYY-MM-DD HH:mm:ss'});

    //导出excle
    $("#excle").click(function () {
        $("#export").val('wyq');
        $("#form").submit();
    })

    //筛选
    $("#search").click(function () {
        $("#export").val('');
        $("#form").submit();
    })

    //分页查询
    $('#page').click(function () {
        let page = $(".mypage").val();
        if (!page){
            return false;
        }
        let url = "<?= $url?>";
        let trueUrl = url+'&page='+page;
        window.location.href = trueUrl;
    })
</script>